﻿Module Module9_1
    Sub Main()
        Dim menu As String
        Do While True
            Console.Clear()
            Console.WriteLine("1. Demo1")
            Console.WriteLine("2. Demo2")
            Console.WriteLine("3. Demo3")
            Console.WriteLine("4. Demo4")
            Console.WriteLine("5. Exit")
            Console.Write("> ")
            menu = Console.ReadLine()
            Select Case menu
                Case "1"
                    Call Demo1()
                Case "2"
                    Call Demo2()
                Case "3"
                    Call Demo3()
                Case "4"
                    Call Demo4()
                Case "5"
                    Exit Sub ' 結束此程序
                Case Else
                    Console.WriteLine("沒有這個選項，請重新輸入.....")
            End Select

            Console.ReadKey()
            Console.Clear()
        Loop

    End Sub

    Sub Demo1()
        ' ------------ 測試1 -------------
        For I = 1 To 3
            For J = 1 To 5
                Console.WriteLine("I={0}  J={1}", I, J)
            Next
            Console.WriteLine()
        Next
    End Sub

    Sub Demo2()
        ' ------------ 測試2 -------------
        For I = 1 To 5
            For J = 1 To 5
                Console.Write("*")
            Next
            Console.WriteLine()
        Next
    End Sub

    Sub Demo3()
        ' ------------ 測試3 -------------
        For I = 1 To 5
            For J = 1 To I
                Console.Write("*")
            Next
            Console.WriteLine()
        Next
    End Sub

    Sub Demo4()
        ' ------------ 測試4 -------------
        For I = 1 To 9
            For J = 1 To 9
                Console.WriteLine("{0} x {1} = {2}", I, J, I * J)
            Next
            Console.ReadKey()
            Console.WriteLine()
        Next
    End Sub

End Module
